package com.xyz.study.design_mode.f_prototype.mode;

import java.util.HashMap;
import java.util.Map;

/**
 * 角色：Client
 * @author XYZ
 * @version 1.0.0
 * @since 2021/1/19
 */
public class Manager {
    private final Map<String, Product> store = new HashMap<>();

    public void register(String key, Product product){
        store.put(key, product);
    }

    public Product getClone(String key){
        Product product = store.get(key);
        if (product == null){
            return null;
        }
        return product.createClone();
    }
}
